# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-mame2000
pkgver=0.37.0.12
_realname=Matrix
pkgrel=1
pkgdesc="MAME 2000 GameClient for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.mame2000"
arch="x86 x86_64" # kodi
#aarch64: blocked by libretro-mame2000 (why?)
license="custom"
makedepends="cmake kodi-dev"
depends="kodi-game-libretro libretro-mame2000"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.mame2000/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.mame2000-$pkgver-$_realname"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
	rm -r "$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2000/game.libretro.mame2000.so
	ln -s /usr/lib/libretro/mame2000_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.mame2000/game.libretro.mame2000.so
}

sha512sums="d15e205c769f214796ee5640e62378164980ab093b92d97b7b36d98633f3e956de6dfd7beb60ef06cfd6d1d338adf07c7ea27b50b2741f82485aa3ecff801c7d  kodi-game-libretro-mame2000-0.37.0.12-Matrix.tar.gz"
